// pages/components/pay/x.js
const api = require('../../../utils/request')
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    hotline: {
      type: 'String',
      value: ''
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    isSuccess:false, //是否验证成功

  },

  /**
   * 组件的方法列表
   */
  methods: {

    hideClose() {
      this.triggerEvent('close')
    },
    callPhone() {
      wx.makePhoneCall({
        phoneNumber: this.data.hotline || '0539-7877989',
        success: function () {
          console.log('成功拨打电话')
        },
        fail(){}
      })
    },
    newPasswordInput(e) {
      const val = e.detail.value;
      this.setData({
        newPassword: val,
      });
    },
    setStep() {
      let _this = this
      api._get('/api?method=user.paypwdcheck',{pwd:this.data.newPassword},'noload').then(res=>{
        getApp().toast('验证成功')
        setTimeout(function() {
        _this.setData({
          isSuccess:true
        })
         _this.triggerEvent('pwdcheck_success',_this.data.newPassword)
        },1000)
      })  
    }
  }
})